import type {useLoadingBar} from "naive-ui";
import {merge} from "lodash-es";

/**
 * @FileName: global-config.ts
 * @Description: // 全局配置
 * @Author: Ellwood(liugangsin@qq.com)
 * @CreateDate: 2025/2/7 - 15:01
 * @Version: V1.0.0
 */

export interface GlobalConfigType {
  notification?: ReturnType<typeof useNotification>;
  message?: ReturnType<typeof useMessage>;
  dialog?: ReturnType<typeof useDialog>;
  loadingBar?: ReturnType<typeof useLoadingBar>;
}

const globalConfig: GlobalConfigType = {};

export const useGlobalConfig = () => {
  return globalConfig;
};

export const useGlobalConfigProvider = (config: GlobalConfigType) => {
  merge(globalConfig, config);
};
